Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Better ingress error message on permission denied #1666

Merged
merged 1 commit into from
Sep 3, 2020

Conversation

cathyzhyi
Copy link
Contributor

@cathyzhyi cathyzhyi commented Sep 2, 2020

Fixes #1631

Proposed Changes

Release Note

Provide additional error info when auth with pubsub fails in broker ingress.

Docs

@google-cla google-cla bot added the cla: yes (override cla status due to multiple authors bug) label Sep 2, 2020
case grpcstatus.Code(res) == grpccode.PermissionDenied:
const msg string = "Failed to publish to PubSub because permission denied.\n" +
"Please refer to \"Configure the Authentication Mechanism for GCP\" at " +
"https://github.com/google/knative-gcp/blob/master/docs/install/install-knative-gcp.md"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to point broker installation page(https://github.com/google/knative-gcp/blob/master/docs/install/install-gcp-broker.md) rather than install knative-gcp page (this is for the Control Plane setup)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Grace! Modified accordingly.

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-google-knative-gcp-wi-tests 0/3

Failed non-flaky tests preventing automatic retry of pull-google-knative-gcp-wi-tests:

test/e2e.TestSmokeCloudPubSubSourceV1beta1

@grac3gao-zz
Copy link
Contributor

/retest

Comment on lines 170 to 172
const msg string = "Failed to publish to PubSub because permission denied.\n" +
"Please refer to \"Configure the Authentication Mechanism for GCP\" at " +
"https://github.com/google/knative-gcp/blob/master/docs/install/install-gcp-broker.md"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the top you can define a constant like

const deniedErrMsg string = `Failed to publish to PubSub because permission denied.
Please refer to "Configure the Authentication Mechanism for GCP" at https://github.com/google/knative-gcp/blob/master/docs/install/install-gcp-broker.md
`

And use it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the const string definition to the top of the file as suggested. Thanks!

statusCode = nethttp.StatusServiceUnavailable
case grpcstatus.Code(res) == grpccode.PermissionDenied:
const msg string = "Failed to publish to PubSub because permission denied.\n" +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a TODO. I think eventually we want to put a link to the official doc rather than github doc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODO. thanks for the suggestion!

pkg/broker/ingress/handler.go Show resolved Hide resolved
@yolocs
Copy link
Member

yolocs commented Sep 3, 2020

Since this has impact on user facing function, it's best to add a release note. I helped to add it for this PR.

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-google-knative-gcp-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/broker/ingress/handler.go 92.9% 89.5% -3.4

Copy link
Member

@yolocs yolocs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cathyzhyi, yolocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit b0e7371 into google:master Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved cla: yes (override cla status due to multiple authors bug) lgtm size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better ingress error message on pubsub authentication problem
6 participants